Fix sinatra extension registration #337
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It seems like pliny is not configuring its
Serialize
extension correctly. The extensions guide explains how to extend the DSL (asSerialize
is doing here with itsserializer
method) - usingregister
.As is stands this module is depending on internal behaviour of sinatra - that it uses
include
to pull in helpers - so it was always at risk of breaking. In sinatra 2.1 it finally broke - the internal behaviour changed to useprepend
.#336 is a simple fix for this - switching the module to assume it is
prepended
rather thanincluded
- but there is no guarantee this behaviour won't change and break things again. Unfortunately the problem with this change is it requires a change in applications using pliny:I would probably just take the hit and go with this change, so we're protected from changes in future. Given pliny is still on a
0.x.y
version it's "allowed" (according to SemVer) to break stuff. I doubt the number of applications using pliny is large, so we're not generating a large amount of effort downstream because of this.